//
//  OrderView.swift
//  AirlineReservation
//
//  Created by Kevin on 2020/1/23.
//  Copyright © 2020 Kevin. All rights reserved.
//

import UIKit

class OrderView: UIButton {
    
    // 订文本
    private lazy var order = UILabel(title: "订",color: UIColor.white,align: .center)
    // 余文本
    private lazy var surplus = UILabel(title: "余0张",color: COLOR_RED,size: 10,align:.center)
    
    // MARK: 设置剩余票量
    public var count:String?
    
    public var submitText:String? {
        didSet {
            order.text = submitText
        }
    }
    
    override func layoutSubviews() {
        // 订文本
        order.frame = CGRect(x: 0, y: 0, width: frame.width, height:frame.height * 0.6)
        order.font = UIFont.boldSystemFont(ofSize: 13)
        order.backgroundColor = COLOR_RED
        order.isUserInteractionEnabled = false
        addSubview(order)
        // 余文本
        if let cou = count {
            surplus.text = "余\(cou)张"
        }
        surplus.frame = CGRect(x: 0, y: frame.height * 0.6, width: frame.width, height: frame.height * 0.4)
        surplus.isUserInteractionEnabled = false
        addSubview(surplus)
    }
}
